home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 37
/
Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso
/
Aminet
/
dev
/
basic
/
Mildred.lha
/
lha
/
SineExample.lha
/
SineExample2.ascii
< prev
next >
Wrap
Text File
|
1999-03-23
|
4KB
|
114 lines
;Wavey Logo Mildred Library Example.
;
;Programmed by : Mikkel Loekke, aka. FlameDuck.
;
;Please read the README file.
;
;Modified by Paul West to use OffsetList with MScroll and lookup tables
WBStartup
NoCli
DEFTYPE.l
degrad.q = Pi/180 ; Since the computer works in
; radians, we need this value
; to convert our angle to radians.
; (Or something) :o)
Dim Lookup.w(750) ; Setup our sine lookup table.
Dim Lookup2.w(750)
For i=0 To 750 ; Array needs to be .w. If you use .q it will not work properly
Lookup(i)=Sin((i)*degrad*3)*30
Lookup2(i)=Sin((i)*degrad*2)*20
Next
NEWTYPE.OffsetList
LineWidth.w
X1Offset.w
X2Offset.w
SourceModuloOffset.w
End NEWTYPE
Dim rows.OffsetList(570)
rows(0)\LineWidth=320,0,Lookup(0),0
For y=1 To 570 ; Do the sine wavey bits.
rows(y)\LineWidth=320
rows(y)\X1Offset=Lookup(y)-Lookup(y-1)
rows(y)\X2Offset=0
rows(y)\SourceModuloOffset=0
Next
MCPU Processor ; Tell Mildred which CPU it should use.
Mc2pCPUmode Processor ; Tell Mildred which CPU it should us for c2p.
MReserveBitmaps 2 ; Tell Mildred that we're going to use 2 chunky bitmaps.
MReservec2pWindows 1 ; Tell it we only need one c2p display.
.initgraphics
MCludgeBitmap 0,320,210,?inclogo ; Go fetch our original chunky image.
MBitmap 1,320,250 ; This will contain our chunky buffer.
Mc2pWindow 0,320,210 ; Setup structures for c2p conversions.
InitBank 0,320*210,$10002 ; Get some free CHIP memory.
CludgeBitMap 0,320,210,8,Bank(0) ; And make it a planar bitmap.
Dim scrtaglst.TagItem(7) ; All this stuff sets up our
scrtaglst(0)\ti_Tag = #SA_Left ; Taglist for the screen we
scrtaglst(0)\ti_Data = 0 ; want. As you can see, it's
scrtaglst(1)\ti_Tag = #SA_Depth ; rather non-standard.
scrtaglst(1)\ti_Data = 8 ; it doesn't have to be, it's
scrtaglst(2)\ti_Tag = #SA_Width ; just that this routine needs
scrtaglst(2)\ti_Data = 320 ; a larger screen to avoid
scrtaglst(3)\ti_Tag = #SA_Height ; clipping.
scrtaglst(3)\ti_Data = 210
scrtaglst(4)\ti_Tag = #SA_BitMap
scrtaglst(4)\ti_Data = Addr BitMap (0)
scrtaglst(5)\ti_Tag = #SA_ShowTitle
scrtaglst(5)\ti_Data = 0
scrtaglst(6)\ti_Tag = #SA_Draggable
scrtaglst(6)\ti_Data = 0
scrtaglst(7)\ti_Tag = #TAG_END ; The most important tag of them all.
ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
DecodePalette 0,?incpal ; Get our IncBin'ed palette info.
ShowPalette 0 ; Attach our palette to the screen.
MUseBitmap 1 ; Tell Mildred to use our main
; chunky buffer (just in case)
Repeat ; Repeat our mainloop ....
Mc2p Bank(0) ; Convert our chunky buffer to
; our planar bitmap.
Temp.w=rows(deg)\X1Offset
rows(deg)\X1Offset=Lookup(deg)
MScroll 0,0,320,210,0,0,0,&rows(deg) ; Tell Mildred how to move our graphics arround, and where to put them.
rows(deg)\X1Offset=Temp
For x=0 To 319 Step 2
MScroll x,20+Lookup2(deg+x),2,210,x,0
Next x
deg+1 ; do another degree on the sinewave.
If deg=360 Then deg=0
Until RawStatus($45) ; .... Until we press Escape.
End ; End our nice program.
Even4 ; put following data on an even address. Minor speed increase.
.incpal
IncBin "IntroLogo.PAL" ; Include our palette information in the binary.
Even4 ; Same as last time :o)
Ds.l 16
.inclogo
IncBin "IntroLogo.CNK" ; Include our chunky logo.
Ds.l 16